package com.itheima.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.Result;
import com.itheima.pojo.OrderInfo;
import com.itheima.pojo.Setmeal;
import com.itheima.service.AppointmentService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description:
 * @author: tantan
 * @date: 2020/4/20-8:44
 * @Version: 1.0.0
 */
@RestController
@RequestMapping("/appointment")
public class AppointmentController {

    @Reference
    AppointmentService appointmentService;

    @RequestMapping("/findAllSetmeals")
    public Result findAllSetmeals(){
        List<Setmeal> setmealList = appointmentService.findAllSetmeals();
        return Result.OK("",setmealList);
    }

    @RequestMapping("/submit")
    public Result submit(@RequestBody OrderInfo orderInfo){
        orderInfo.setOrderType("电话预约");
       Result result =  appointmentService.submit(orderInfo);
       return  result;
    }
}
